﻿using System;
namespace ORS.OrderRobot.Queue
{
	/// <summary>
	/// 消息队列
	/// </summary>
	public interface IMessageQueue<T>
    {
        /// <summary>
        /// 加入队列
        /// </summary>
        /// <param name="item"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task EnqueueAsync(T item, CancellationToken cancellationToken = default);
        /// <summary>
        /// 消费队列
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<T> DequeueAsync(CancellationToken cancellationToken = default);
        /// <summary>
        /// 长度
        /// </summary>
        int Count { get; }
    }
}

